/****************************************************
          File Name:7-2.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sat 20 Dec 2014 10:08:52 AM CST
*****************************************************/

#include<iostream>
using namespace std;

void input(float *a,int size)
{
    int i = 0;

    cout << "Enter you mark: ";
    while(i < size && cin >> a[i])
    {
        cout << "Enter you mark: ";
        i++;
    }
}

float cal(float *a)
{
    int i = 0;
    float res = 0;

    while(a[i])
    {
        res += a[i];
        i++;
    }

    return res / float(i);
}

int main()
{
    float a[10] = {0};

    input(a, 10);
    
    cout << "The average is: " << cal(a) << endl;

    return 0;
}
